<template>
  <div>
    <h1 class="ml-4 mt-4">
      <!-- #ifdef APP-PLUS -->
      APP跳转
      <!-- #endif -->
      <!-- #ifdef MP -->
      小程序跳转
      <!-- #endif -->
      <!-- #ifdef H5 -->
      H5跳转
      <!-- #endif -->
    </h1>
    <wd-select-picker label="小程序跳转类型" v-model="value" :columns="columns" type="radio"
      @change="handleChange"></wd-select-picker>
    <div class="fixed bottom-0 left-0 right-0 pb-safe px-4">
      <wd-button custom-class="w-full" @click="goPagePolymerization(url)">点击跳转</wd-button>
    </div>
  </div>

</template>


<script setup lang="ts">
import { jAlert3 } from '@/utils';
import { goPagePolymerization } from '@/utils/auth';

onShareAppMessage(() => ({
  title: '微信跳转大全',
  path: 'wxwork://'
}));


const columns = ref<Record<string, any>>([
  // #ifdef MP-WEIXIN
  {
    value: '1',
    label: '跳转自身小程序',
    url: '/pagesA/theme/index'
  },
  {
    value: '2',
    label: '跳转第三方小程序',
    url: '/pages/mall/index?appid=wxeda1e799ab5b9f57&ghId=gh_50a7edb6bb4f'
  },
  {
    value: '3',
    label: '打开半屏小程序',
    url: '/pages/mall/index?appid=wxeda1e799ab5b9f57&isEmbedded=T&ghId=gh_50a7edb6bb4f'
  },
  {
    value: '4',
    label: '跳转H5',
    url: 'https://www.yinuosnowball.top/h5/commonJump'
  },
  {
    value: '5',
    label: '跳转APP',
    url: 'https://www.yinuosnowball.top/h5/commonJump?urlScheme=weixin://'
  },

  // #endif


  // #ifdef H5
  {
    value: '1',
    label: '跳转自身页面',
    url: '/pagesA/theme/index'
  },
  {
    value: '2',
    label: '跳转第三方H5',
    url: 'https://www.yinuosnowball.top/h5/commonJump'
  },
  {
    value: '3',
    label: '跳转小程序',
    url: '/pages/commonJump/index?urlScheme=weixin://dl/business/?appid=wxeda1e799ab5b9f57&path=pages/mall/index'
  },
  {
    value: '4',
    label: '跳转APP',
    url: '/pages/commonJump/index?urlScheme=hbuilder://'
  },



  // #endif


  // #ifdef APP-PLUS

  {
    value: '1',
    label: '跳转自身页面',
    url: '/pagesA/theme/index'
  },
  {
    value: '2',
    label: '跳转第三方H5(内嵌)',
    url: 'https://www.yinuosnowball.top/h5/commonJump'
  },
  {
    value: '3',
    label: '跳转第三方H5(外部打开)',
    url: 'https://www.yinuosnowball.top/h5/commonJump?isOpenExtenal=T'
  },
  {
    value: '5',
    label: '跳转小程序',
    url: '/pages/commonJump/index?ghId=gh_50a7edb6bb4f&path=pages/mall/index'
  },
  {
    value: '4',
    label: '跳转小程序(urlScheme)',
    url: '/pages/commonJump/index?urlScheme=weixin://dl/business/?appid=wxeda1e799ab5b9f57&path=pages/mall/index'
  },
  {
    value: '6',
    label: '跳转APP',
    url: '/pages/commonJump/index?urlScheme=weixin://'
  },
  {
    value: '7',
    label: '跳转APP(launch)',
    url: '/pages/commonJump/index?pname=T'
  },


  // #endif
  // {
  //   value: '1',
  //   label: '跳转自身小程序',
  //   url: '/pages/index/index'
  // },
  // {
  //   value: '2',
  //   label: '跳转第三方小程序',
  //   url: '/pages/mall/index?appid=wxeda1e799ab5b9f57&ghId=gh_50a7edb6bb4f'
  // },
  // {
  //   value: '2-1',
  //   label: '跳转第三方小程序shortLink',// app不可以
  //   url: '/pages/mall/index?shortLink=#小程序://ihotel测试/liZh6bFzcfXoReh'
  // },
  // {
  //   value: '3',
  //   label: '打开半屏小程序',
  //   url: '/pages/mall/index?appid=wxeda1e799ab5b9f57&isEmbedded=T&ghId=gh_50a7edb6bb4f'
  // },
  // {
  //   value: '3-1',
  //   label: '打开半屏小程序shortLink',
  //   url: '/pages/mall/index?&isEmbedded=T&shortLink=#小程序://ihotel测试/WwNeE8KbOtPpI8A'
  // },
  // {
  //   value: '4',
  //   label: '跳转H5',
  //   url: 'https://www.yinuosnowball.top/commonJump'
  // },
  // {
  //   value: '5',
  //   label: '跳转H5 APP',
  //   url: 'https://www.yinuosnowball.top/commonJump?debug=T&appUrlScheme=weixin://dl/business/?t=HZ2gBmGKRzp'
  // },
  // {
  //   value: '5-1',
  //   label: '跳转H5 APP 企业微信',
  //   url: 'https://www.yinuosnowball.top/commonJump?&debug=T&appUrlScheme=wxwork://'
  // },
  // {
  //   value: '5-2',
  //   label: '跳转H5 内嵌打开自身小程序页面',
  //   url: 'https://www.yinuosnowball.top/uniH5/commonJump?&debug=T&url=/pagesA/theme/index'
  // },
  // {
  //   value: '5-3',
  //   label: '跳转H5 内嵌打开外部小程序',
  //   url: 'https://www.yinuosnowball.top/commonJump?&debug=T&appid=wxeda1e799ab5b9f57&page=/pages/mall/index'
  // },
  // {
  //   value: '6',
  //   label: '其他情况提示',
  //   url: '暂未开放'
  // },
  // {
  //   value: '7',
  //   label: 'APP或者H5跳转APP',
  //   url: '?urlScheme=weixin://'
  // },
  // {
  //   value: '8',
  //   label: 'H5跳转自身APP',
  //   url: '?urlScheme=hbuilder://'
  // },
])
const value = ref<string>('1')
const url = ref('/pagesA/theme/index')

const handleChange = (e) => {
  url.value = columns.value.find(item => item.value === e.value).url
  console.log('打印***value', e, url.value)
}



</script>

<style scoped lang="scss"></style>
